package isr.cloudgate.dashboard.properties;

import java.util.Locale;
import java.util.ResourceBundle;
import java.util.logging.Logger;

public class Messages {

  public static enum Key {
    DELETE_ADMIN, GROUP_LIST_RESPONSE, LOGIN_FAILURE, LOGIN_REQUIRED,
    LOGIN_SUCCESS, NO_DOMAIN, USER_LIST_RESPONSE
  }

  private static final Logger logger = Logger.getLogger(Messages.Key.class
    .getName());

  public static String getString(Locale locale, Key _key) {
    String value = null;

    try {

      ResourceBundle messages = ResourceBundle.getBundle("messages", locale);
      value = messages.getString(_key.name());

    } catch (Exception e) {

      logger.warning("ERROR on message key '" + _key + "': " + e);

    }

    return value;
  }

}
